package com.lzx.resumeweb.api;

import com.lzx.resumebase.model.Edu;
import com.lzx.resumebase.model.Result;
import com.lzx.resumebase.util.ResultUtil;
import com.lzx.resumeservice.service.EduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName EduApi
 * @Author 刘正星
 * @Date 2021/6/1 2:30
 **/
@RestController
@RequestMapping("/edu")
public class EduApi {

    @Autowired
    private EduService eduService;

    @GetMapping("/getByUserId/{userId}")
    public Result getEdu(@PathVariable("userId")String userId){
        if (!StringUtils.hasText(userId)){
            return ResultUtil.paramError();
        }
        return ResultUtil.success(eduService.lambdaQuery().eq(StringUtils.hasText(userId),Edu::getUserid,userId).list());
    }
}
